from django.db.models.signals import pre_save

from models import Invite, INVITES_PER_USER

def decrease_invites_count(sender, instance, *args, **kw):
	instance.user.invites_left -= 1
	instance.user.save() 

if INVITES_PER_USER:
	pre_save.connect(decrease_invites_count, Invite)
